Add format option to paginate() for customizing pagination URLs#17258
Open
astrobot-houston wants to merge 3 commits into
Open
Add format option to paginate() for customizing pagination URLs#17258astrobot-houston wants to merge 3 commits into
format option to paginate() for customizing pagination URLs#17258astrobot-houston wants to merge 3 commits into
Conversation
1 task
🦋 Changeset detectedLatest commit: 4c1e197 The changes in this PR will be included in the next version bump. This PR includes changesets to release 395 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
matthewp
requested changes
Jul 1, 2026
matthewp
left a comment
Contributor
There was a problem hiding this comment.
missing a changeset and needs docs
Add a `format` option to `PaginateOptions` that accepts a callback
`(url: string) => string` to transform pagination URLs (current, next,
prev, first, last) before they are set on the page result.
This allows users deploying to static file servers that don't support
clean URLs to add file extensions like `.html`:
paginate(items, {
format: (url) => `${url}.html`,
})
Fixes #13604
daa9ae8 to
7a94fdf
Compare
Member
|
Added changeset and docs |
ArmandPhilippot
approved these changes
Jul 6, 2026
ArmandPhilippot
left a comment
Member
There was a problem hiding this comment.
A non-blocking suggestion, otherwise LGTM.
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
yanthomasdev
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
formatoption toPaginateOptionsthat accepts a(url: string) => stringcallback. When provided, it is applied to all pagination URLs (current,next,prev,first,last) after they are constructed..html(or apply any other transformation) to pagination URLs generated bypaginate().Closes #13604
Testing
describeblocks (8 test cases) topackages/astro/test/units/render/paginate.test.tscovering:formatapplied to all URL properties,formatskipped forundefinedURLs,formatapplied after base path is prepended, and no regression whenformatis omitted.Docs
formatoption is documented inline via JSDoc onPaginateOptions. A docs-site update to thepaginate()reference may be warranted to surface this option for users hitting 404s on static file servers.withastro/docs#14201
@withastro/maintainers-docs for feedback